{
  open Cparser 
  open Gencode.ClangExec 
  exception Lexerror 
  exception Syntax_error 
}

let alph     =  ['a'-'z''A'-'Z']
let alph_big   =  ['A'-'Z']
let alph_small =  ['a'-'z']
let num      =  ['0'-'9'] 
let decimal  =  '0'|(['1'-'9']['0'-'9']*)

let comment  =  '/' '*' [^'*']* ('*' (('*'*)|([^'*''/'][^'*']*)))* '*' '/'

rule token   = parse

[' ' '\t']     { token lexbuf }
| ['\n']       { token lexbuf }
| comment      { token lexbuf } 

| decimal as i { INTCONSTANT (int_of_string i)}

| "bool"       { TP Gencode.ClangExec.BoolT }
| "int"        { TP Gencode.ClangExec.NatT }
| "true"       { BCONSTANT true }
| "false"      { BCONSTANT false }

| "if"         { IF }
| "then"       { THEN }
| "else"       { ELSE }
| "fi"         { FI }
| "while"      { WHILE }
| "do"         { DO }
| "end"        { END }
| "wait"       { WAIT }

| "Process"    { PROCESS }
| "local"      { LOCAL }
| "shared"     { SHARED }

|"|"           { DISJ } 
|'{'           { OPEN_BRACE }
|'}'           { CLOSE_BRACE }
| '('          { LPAREN }
| ')'          { RPAREN }
| ":="         { ASG }
| ';'          { SEMICOLON }
| ':'          { COLON }
| '='          { EQ }
| "!="         { NEQ }
| eof          { EOF }

| alph_small(alph|num)* as i {IDENTIFIER i}
| alph_big(alph|num)* as i {SIDENTIFIER i}

| _ {Printf.printf "ERROR: unreconized symbol '%s' " (Lexing.lexeme lexbuf); raise (Syntax_error);}
